package com.weasel.weixin.commons.message.builder;

import com.weasel.weixin.commons.message.bean.AbstractWeiXinPostCommonXmlAnswerMessage;

/**
 * Created by Dylan on 2015/10/19.
 */
public abstract class AbstractWeixinPostCommonXmlAnswerMessageBuilder<T extends AbstractWeixinPostCommonXmlAnswerMessageBuilder,M extends AbstractWeiXinPostCommonXmlAnswerMessage> {

    protected AbstractWeiXinPostCommonXmlAnswerMessage message;

    public AbstractWeixinPostCommonXmlAnswerMessageBuilder(AbstractWeiXinPostCommonXmlAnswerMessage message) {
        this.message = message;
    }

    public T from(String fromUserName){
        message.setFromUserName(fromUserName);
        return (T)this;
    }

    public T to(String toUserName){
        message.setToUserName(toUserName);
        return (T)this;
    }

    public T time(long createTime){
        message.setCreateTime(createTime);
        return (T)this;
    }

    public M build(){
        return (M)message;
    }

}
